package kaiin;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

public class Regsend extends HttpServlet{

	public void doGet(HttpServletRequest req, HttpServletResponse res)
	throws ServletException, IOException {
		this.doPost(req, res);
	}

	/**
	 * post用メソッド
	 */
	public void doPost(HttpServletRequest req, HttpServletResponse res)
			throws ServletException, IOException {
		// レスポンスのエンコードの指定
		res.setContentType("text/html; charset=utf-8");
		// リクエストパラメータのエンコード指定
		req.setCharacterEncoding("utf-8");

		HttpSession session = req.getSession(true);

		//以下は確認のため、遷移先で表示できるように「setAttribute」としています。
		//DBへの登録用に、適宜変更して下さい。
		String id = (String)session.getAttribute("id");
		req.setAttribute("id",id);

		String password = (String)session.getAttribute("password");
		req.setAttribute("password",password);

		String name = (String)session.getAttribute("name");
		req.setAttribute("name",name);

		String ruby = (String)session.getAttribute("ruby");
		req.setAttribute("ruby",ruby);

		String year = (String)session.getAttribute("year");
		req.setAttribute("year",year);

		String month = (String)session.getAttribute("month");
		req.setAttribute("month",month);

		String day = (String)session.getAttribute("day");
		req.setAttribute("day",day);

		String sex = (String)session.getAttribute("sex");
		req.setAttribute("sex",sex);

		String postcode1 = (String)session.getAttribute("postcode1");
		req.setAttribute("postcode1",postcode1);

		String postcode2 = (String)session.getAttribute("postcode2");
		req.setAttribute("postcode2",postcode2);

		String prefecture = (String)session.getAttribute("prefecture");
		req.setAttribute("prefecture",prefecture);

		String address1 = (String)session.getAttribute("address1");
		req.setAttribute("address1",address1);

		String address2 = (String)session.getAttribute("address2");
		req.setAttribute("address2",address2);

		String email = (String)session.getAttribute("email");
		req.setAttribute("email",email);

		String tel = (String)session.getAttribute("tel");
		req.setAttribute("tel",tel);

		String cell = (String)session.getAttribute("cell");
		req.setAttribute("cell",cell);

		//以下の文はDBには送らず、テストページにて値の確認をしています。
		//この処理は適宜変更または削除して下さい。
		RequestDispatcher rd = req.getRequestDispatcher("./src/jsp/kaiin/sendtest.jsp");
		rd.forward(req, res);
	}
}